using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Joy.Erp.BasicArchives.Core.Filters;

namespace Joy.Erp.BasicArchives.ProductionUnit
{
    [RemoteService(Name = BasicArchivesRemoteServiceConsts.RemoteServiceName)]
    [Area(BasicArchivesRemoteServiceConsts.ModuleName)]
    [ControllerName("WorkCenter")]
    [Route("api/basic-archives/work-center")]
    public partial class WorkCenterController : BasicArchivesController, IWorkCenterAppService
    {
        protected IWorkCenterAppService WorkCenterAppService => LazyServiceProvider.LazyGetRequiredService<IWorkCenterAppService>();

        [HttpGet]
        [Route("{id}")]
        public Task<WorkCenterDto> GetAsync(Guid id)
        {
            return WorkCenterAppService.GetAsync(id);
        }

        [HttpGet]
        [Route("find")]
        public Task<WorkCenterDto> FindAsync(string filter)
        {
            return WorkCenterAppService.FindAsync(filter);
        }

        [HttpGet]
        [Route("find-by-source-key")]
        public Task<WorkCenterDto> FindBySourceKeyAsync(string sourceKey, string sourceType)
        {
            return WorkCenterAppService.FindBySourceKeyAsync(sourceKey, sourceType);
        }

        [HttpGet]
        public Task<PagedResultDto<WorkCenterDto>> GetListAsync(FilterRequestDto input)
        {
            return WorkCenterAppService.GetListAsync(input);
        }

        [HttpPost]
        [Route("query")]
        public Task<PagedResultDto<WorkCenterDto>> QueryAsync(FilterGroupRequestDto input)
        {
            return WorkCenterAppService.QueryAsync(input);
        }

        [HttpPost]
        public Task<WorkCenterDto> CreateAsync(WorkCenterCreateDto input)
        {
            return WorkCenterAppService.CreateAsync(input);
        }

        [HttpPut]
        [Route("{id}")]
        public Task<WorkCenterDto> UpdateAsync(Guid id, WorkCenterUpdateDto input)
        {
            return WorkCenterAppService.UpdateAsync(id, input);
        }

        [HttpDelete]
        [Route("{id}")]
        public Task DeleteAsync(Guid id)
        {
            return WorkCenterAppService.DeleteAsync(id);
        }
    }
} 